package com.gallop.mq;

import com.gallop.mq.annotation.MQMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@MQMessageListener
@Component
public class MQPayloadListener {

    @MQMessageListener(topic = MQTemplateTest.TEST_PAYLOAD_TOPIC)
    public MQTemplateTest.PayloadResponse listen(MQTemplateTest.Payload payload) {
        log.debug("receive:{}", payload);
        return MQTemplateTest.PayloadResponse.builder()
                .data("response" + payload.getData())
                .id("response" + payload.getId())
                .build();
    }

}
